<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">

      <el-form-item label="员工姓名" prop="employeeName">
        <el-input
          v-model="queryParams.employeeName"
          placeholder="请输入员工姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="岗位" prop="jobId">
        <el-select v-model="queryParams.jobId" placeholder="岗位" clearable>
          <el-option
            v-for="item in postOptions"
            :key="item.postId"
            :label="item.postName"
            :value="item.postId"
            :disabled="item.status == 1"
          ></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="工单状态" prop="stateId">
        <el-select v-model="queryParams.stateId" placeholder="工单状态" clearable>
        <el-option
          v-for="dict in dict.type.kpi_order_state_type"
          :key="dict.value"
          :label="dict.label"
          :value="dict.value"
        />
        </el-select>
      </el-form-item>
      <el-form-item label="绩效月份" prop="performanceDate">
        <el-date-picker clearable
                        v-model="queryParams.performanceDate"
                        type="month"
                        value-format="yyyy-MM"
                        format="yyyy-MM"
                        placeholder="请选择绩效月份">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-tabs   v-model = "listAuditType" @tab-click="handleQueryTabClick">
        <el-tab-pane  label="员工已提交" name="alreadySubmit">
          <el-row :gutter="10" class="mb8">

            <el-col :span="1.5">
              <el-button
                type="warning"
                plain
                icon="el-icon-download"
                size="mini"
                @click="handleExport"
                v-hasPermi="['system:monthly:export']"
              >导出</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="primary"
                plain
                icon="el-icon-add"
                size="mini"
                @click="handleAddKPI"
                v-hasPermi="['system:monthly:add']"
              >录入月度绩效</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="success"
                plain
                icon="el-icon-add"
                size="mini"
                @click="handleGroupAudit"
                :disabled="single"
                v-hasPermi="['system:monthly:groupAudit']"
              >绩效小组评分</el-button>
            </el-col
            ><el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-add"
              size="mini"
              @click="handleAuditSubmitDetail"
              v-hasPermi="['system:monthly:groupAudit']"
            >查询月度绩效提交情况</el-button>
          </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
          </el-row>
            <el-table v-loading="loading" :data="monthlyList" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="员工姓名" align="center" prop="employeeName" />
        <el-table-column label="岗位名称" align="center" prop="jobName" />
        <el-table-column label="绩效月份" align="center" prop="performanceDate" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.performanceDate, '{y}-{m}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="工单状态" align="center" prop="stateId">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.kpi_order_state_type" :value="scope.row.stateId"/>
          </template>
        </el-table-column>


        <el-table-column label="考核评分" align="center" prop="performanceScore" />
        <el-table-column label="月度工作绩效小组意见" align="center" prop="taskGroupOpinion" />
        <el-table-column label="月度工作直线经理意见" align="center" prop="taskManagerOpinion" />
        <el-table-column label="月度工作总评分" align="center" prop="totalScore" />
        <el-table-column label="直线经理加扣分意见" align="center" prop="taskManagerScore" />
        <el-table-column label="加分项绩效小组意见" align="center" prop="itemGroupOpinion" />
        <el-table-column label="加分项直线经理意见" align="center" prop="itemManagerOpinion" />
        <el-table-column label="加分项直线经理评分" align="center" prop="itemManagerScore" />
        <el-table-column label="创建人" align="center" prop="creatorName" />
        <el-table-column label="绩效小组打分人" align="center" prop="groupMemberName" />
        <el-table-column label="绩效小组打分时间" align="center" prop="groupMemberTime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.groupMemberTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="直线经理小组打分人" align="center" prop="managerName" />
        <el-table-column label="直线经理打分时间" align="center" prop="managerDatetime" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.managerDatetime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleManagerAudit(scope.row)"
              :disabled="scope.row.stateId != '2'"
              v-hasPermi="['system:monthly:handleManagerAudit']"
            >直线经理评分</el-button>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleGroupAudit(scope.row)"
              :disabled="scope.row.stateId != '1'"
              v-hasPermi="['system:monthly:groupAudit']"
            >绩效小组评分</el-button>
          </template>
        </el-table-column>
      </el-table>
        </el-tab-pane>
        <el-tab-pane  label="绩效小组已评分" name="groupAudit">
          <el-row :gutter="10" class="mb8">

            <el-col :span="1.5">
              <el-button
                type="warning"
                plain
                icon="el-icon-download"
                size="mini"
                @click="handleExport"
                v-hasPermi="['system:monthly:export']"
              >导出</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="warning"
                plain
                icon="el-icon-add"
                size="mini"
                @click="handleAddKPI"
                v-hasPermi="['system:monthly:add']"
              >录入月度绩效</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="warning"
                plain
                icon="el-icon-add"
                size="mini"
                @click="handleManagerAudit"
                :disabled="single"
                v-hasPermi="['system:monthly:managerAudit']"
              >直线经理评分</el-button>
            </el-col>
            <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-add"
              size="mini"
              @click="handleAuditSubmitDetail"
              v-hasPermi="['system:monthly:groupAudit']"
            >查询月度绩效提交情况</el-button>
          </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
          </el-row>
          <el-table v-loading="loading" :data="monthlyList" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label="员工姓名" align="center" prop="employeeName" />
            <el-table-column label="岗位名称" align="center" prop="jobName" />
            <el-table-column label="绩效月份" align="center" prop="performanceDate" width="180">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.performanceDate, '{y}-{m}') }}</span>
              </template>
            </el-table-column>
            <el-table-column label="工单状态" align="center" prop="stateId">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.kpi_order_state_type" :value="scope.row.stateId"/>
              </template>
            </el-table-column>


            <el-table-column label="考核评分" align="center" prop="performanceScore" />
            <el-table-column label="月度工作绩效小组意见" align="center" prop="taskGroupOpinion" />
            <el-table-column label="月度工作直线经理意见" align="center" prop="taskManagerOpinion" />
            <el-table-column label="月度工作总评分" align="center" prop="totalScore" />
            <el-table-column label="直线经理加扣分意见" align="center" prop="taskManagerScore" />
            <el-table-column label="加分项绩效小组意见" align="center" prop="itemGroupOpinion" />
            <el-table-column label="加分项直线经理意见" align="center" prop="itemManagerOpinion" />
            <el-table-column label="加分项直线经理评分" align="center" prop="itemManagerScore" />
            <el-table-column label="创建人" align="center" prop="creatorName" />
            <el-table-column label="绩效小组打分人" align="center" prop="groupMemberName" />
            <el-table-column label="绩效小组打分时间" align="center" prop="groupMemberTime" width="180">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.groupMemberTime, '{y}-{m}-{d}') }}</span>
              </template>
            </el-table-column>
            <el-table-column label="直线经理小组打分人" align="center" prop="managerName" />
            <el-table-column label="直线经理打分时间" align="center" prop="managerDatetime" width="180">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.managerDatetime, '{y}-{m}-{d}') }}</span>
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleManagerAudit(scope.row)"
                  v-hasPermi="['system:monthly:handleManagerAudit']"
                >直线经理评分</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleGroupAudit(scope.row)"
                  v-hasPermi="['system:monthly:handleGroupAudit']"
                >绩效小组评分</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane  label="直线经理已评分" name="managerAudit">
          <el-row :gutter="10" class="mb8">

            <el-col :span="1.5">
              <el-button
                type="warning"
                plain
                icon="el-icon-download"
                size="mini"
                @click="handleExport"
                v-hasPermi="['system:monthly:export']"
              >导出</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="warning"
                plain
                icon="el-icon-add"
                size="mini"
                @click="handleAddKPI"
                v-hasPermi="['system:monthly:add']"
              >录入月度绩效</el-button>
            </el-col>

            <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-add"
              size="mini"
              @click="handleAuditSubmitDetail"
              v-hasPermi="['system:monthly:groupAudit']"
            >查询月度绩效提交情况</el-button>
          </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
          </el-row>
          <el-table v-loading="loading" :data="monthlyList" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label="员工姓名" align="center" prop="employeeName" />
            <el-table-column label="岗位名称" align="center" prop="jobName" />
            <el-table-column label="绩效月份" align="center" prop="performanceDate" width="180">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.performanceDate, '{y}-{m}') }}</span>
              </template>
            </el-table-column>
            <el-table-column label="工单状态" align="center" prop="stateId">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.kpi_order_state_type" :value="scope.row.stateId"/>
              </template>
            </el-table-column>


            <el-table-column label="考核评分" align="center" prop="performanceScore" />
            <el-table-column label="月度工作绩效小组意见" align="center" prop="taskGroupOpinion" />
            <el-table-column label="月度工作直线经理意见" align="center" prop="taskManagerOpinion" />
            <el-table-column label="月度工作总评分" align="center" prop="totalScore" />
            <el-table-column label="直线经理加扣分意见" align="center" prop="taskManagerScore" />
            <el-table-column label="加分项绩效小组意见" align="center" prop="itemGroupOpinion" />
            <el-table-column label="加分项直线经理意见" align="center" prop="itemManagerOpinion" />
            <el-table-column label="加分项直线经理评分" align="center" prop="itemManagerScore" />
            <el-table-column label="创建人" align="center" prop="creatorName" />
            <el-table-column label="绩效小组打分人" align="center" prop="groupMemberName" />
            <el-table-column label="绩效小组打分时间" align="center" prop="groupMemberTime" width="180">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.groupMemberTime, '{y}-{m}-{d}') }}</span>
              </template>
            </el-table-column>
            <el-table-column label="直线经理小组打分人" align="center" prop="managerName" />
            <el-table-column label="直线经理打分时间" align="center" prop="managerDatetime" width="180">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.managerDatetime, '{y}-{m}-{d}') }}</span>
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleManagerAudit(scope.row)"
                  v-hasPermi="['system:monthly:handleManagerAudit']"
                >直线经理评分</el-button>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleGroupAudit(scope.row)"
                  v-hasPermi="['system:monthly:handleGroupAudit']"
                >绩效小组评分</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
      </el-tabs>


    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 查询月度绩效提交情况对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <template>
        <div class="el-dialog-div">
          <el-tabs   v-model = "activeName" @tab-click="handleTabClick">
            <el-form :model="queryAuditParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">

              <el-form-item label="员工姓名" prop="employeeName">
                <el-input
                  v-model="queryAuditParams.employeeName"
                  placeholder="请输入员工姓名"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="部门" prop="jobId">
                <el-select v-model="queryAuditParams.deptId" placeholder="部门" clearable>
                  <el-option
                    v-for="item in deptOptions"
                    :key="item.deptId"
                    :label="item.deptName"
                    :value="item.deptId"

                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="绩效月份" prop="performanceDate">
                <el-date-picker clearable
                                v-model="queryParams.performanceDate"
                                type="month"
                                value-format="yyyy-MM"
                                format="yyyy-MM"
                                placeholder="请选择绩效月份">
                </el-date-picker>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleAuditQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetAuditQuery">重置</el-button>
              </el-form-item>
            </el-form>
            <el-tab-pane  label="已提交员工" name="yes">
              <el-table v-loading="loading" :data="yesTabData" >

                <el-table-column label="员工姓名" align="center" prop="employeeName" />
                <el-table-column label="岗位名称" align="center" prop="jobName" />
                <el-table-column label="部门名称" align="center" prop="deptName" />
                <el-table-column label="绩效月份" align="center" prop="performanceDate" width="180">
                  <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.performanceDate, '{y}-{m}') }}</span>
                  </template>
              </el-table-column>
              </el-table>

              <pagination
                v-show="auditTotal>0"
                :total="auditTotal"
                :page.sync="queryParams.pageNum"
                :limit.sync="queryParams.pageSize"
                @pagination="getAuditList"
              />

            </el-tab-pane>
            <el-tab-pane label="未提交员工" name="no">
              <el-table v-loading="loading" :data="noTabData" >

                <el-table-column label="员工姓名" align="center" prop="employeeName" />
                <el-table-column label="岗位名称" align="center" prop="jobName" />
                <el-table-column label="部门名称" align="center" prop="deptName" />
                <el-table-column label="绩效月份" align="center" prop="performanceDate" width="180">
                  <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.performanceDate, '{y}-{m}') }}</span>
                  </template>
                </el-table-column>
              </el-table>
              <pagination
                v-show="auditTotal>0"
                :total="auditTotal"
                :page.sync="queryAuditParams.pageNum"
                :limit.sync="queryAuditParams.pageSize"
                @pagination="getAuditList"
              />
            </el-tab-pane>
          </el-tabs>
        </div>
      </template>
      <div slot="footer" class="dialog-footer">

        <el-button @click="cancel">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listMonthlyAudit, getMonthly, delMonthly, listMonthlyAuditSubmitDetail,listMonthlyAuditNoSubmitDetail } from "@/api/system/monthly";
import { optionselect } from "@/api/system/post";
import { deptOptionSelect } from "@/api/system/dept";

export default {
  name: "Monthly",
  dicts: ['kpi_job_type','kpi_order_state_type'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      //选中的row对象
      selectedRow: {},
      //选中的对象列表
      selectedRows: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      //dialog总条数
      auditTotal: 0,
      // 月度绩效管理表格数据
      monthlyList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      //岗位选择框
      postOptions: [],
      //部门选择框
      deptOptions: [],
      //已提交tab页面的数据
      yesTabData: [],
      //未提交tab页面的数据
      noTabData: [],
      //tab页默认打开未提交
      activeName:'no',
      //查询tab页默认打开已提交待审批
      listAuditType: 'alreadySubmit',
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        employeeId: null,
        employeeName: null,
        jobId: null,
        jobName: null,
        stateId: null,
        stateName: null,
        constructionOperationDetails: null,
        specialWork: null,
        safetyOperation: null,
        taskGroupOpinion: null,
        totalScore: null,
        taskManagerScore: null,
        taskManagerOpinion: null,
        addingScoreItems: null,
        itemGroupOpinion: null,
        itemManagerScore: null,
        itemManagerOpinion: null,
        performanceDate: null,
        creatorId: null,
        creatorName: null,
        groupMemberId: null,
        groupMemberName: null,
        groupMemberTime: null,
        managerId: null,
        managerName: null,
        managerDatetime: null,
        performanceScore: null,
        deptId: null,
        deptName: null,
      },
      // 查询参数
      queryAuditParams: {
        pageNum: 1,
        pageSize: 10,
        employeeId: null,
        employeeName: null,
        jobId: null,
        jobName: null,
        stateId: null,
        stateName: null,
        managerId: null,
        managerName: null,
        managerDatetime: null,
        deptId: null,
        deptName: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        employeeId: [
          { required: true, message: "员工ID不能为空", trigger: "blur" }
        ],
        employeeName: [
          { required: true, message: "员工姓名不能为空", trigger: "blur" }
        ],
        jobId: [
          { required: true, message: "岗位不能为空", trigger: "blur" }
        ],
        stateId: [
          { required: true, message: "工单状态不能为空", trigger: "blur" }
        ],
        stateName: [
          { required: true, message: "工单状态不能为空", trigger: "blur" }
        ],
        constructionOperationDetails: [
          { required: true, message: "建设运营情况不能为空", trigger: "blur" }
        ],
        specialWork: [
          { required: true, message: "业务专项工作不能为空", trigger: "blur" }
        ],
        safetyOperation: [
          { required: true, message: "安全运维工作不能为空", trigger: "blur" }
        ],
        taskGroupOpinion: [
          { required: true, message: "月度工作绩效小组意见不能为空", trigger: "blur" }
        ],
        totalScore: [
          { required: true, message: "总评分不能为空", trigger: "blur" }
        ],
        taskManagerScore: [
          { required: true, message: "直线经理加扣分意见不能为空", trigger: "blur" }
        ],
        taskManagerOpinion: [
          { required: true, message: "月度工作直线经理意见不能为空", trigger: "blur" }
        ],
        itemGroupOpinion: [
          { required: true, message: "加分项绩效小组意见不能为空", trigger: "blur" }
        ],
        itemManagerScore: [
          { required: true, message: "加分项直线经理评分不能为空", trigger: "blur" }
        ],
        itemManagerOpinion: [
          { required: true, message: "加分项直线经理意见不能为空", trigger: "blur" }
        ],
        performanceDate: [
          { required: true, message: "绩效月份不能为空", trigger: "blur" }
        ],
        createTime: [
          { required: true, message: "创建时间不能为空", trigger: "blur" }
        ],
        creatorId: [
          { required: true, message: "创建人ID不能为空", trigger: "blur" }
        ],
        creatorName: [
          { required: true, message: "创建人不能为空", trigger: "blur" }
        ],
        groupMemberId: [
          { required: true, message: "绩效小组打分人ID不能为空", trigger: "blur" }
        ],
        groupMemberName: [
          { required: true, message: "绩效小组打分人不能为空", trigger: "blur" }
        ],
        managerId: [
          { required: true, message: "直线经理打分人ID不能为空", trigger: "blur" }
        ],
        managerName: [
          { required: true, message: "直线经理小组打分人不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
    this.optionSelect();
    this.getNoSubmitList();
    this.deptOptionSelect();
  },
  methods: {
    /** 查询月度绩效管理列表 */
    getList() {
      this.loading = true;

      if (this.listAuditType == 'alreadySubmit'){
        this.queryParams.stateId = '1';
      }else if (this.listAuditType == 'groupAudit'){
        this.queryParams.stateId = '2';
      }else if (this.listAuditType == 'managerAudit'){
        this.queryParams.stateId = '3';
      }

      listMonthlyAudit(this.queryParams).then(response => {
        console.log("monthlyList--------------"+response.rows)
        this.monthlyList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    optionSelect(){
      optionselect().then(response => {
        this.postOptions = response.data;
      });
    },
    deptOptionSelect(){
      deptOptionSelect().then(response => {
        this.deptOptions = response.data;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: '',
        employeeId: null,
        employeeName: null,
        jobId: null,
        jobName: null,
        stateId: null,
        stateName: null,
        constructionOperationDetails: null,
        specialWork: null,
        safetyOperation: null,
        taskGroupOpinion: null,
        totalScore: null,
        taskManagerScore: null,
        taskManagerOpinion: null,
        addingScoreItems: null,
        itemGroupOpinion: null,
        itemManagerScore: null,
        itemManagerOpinion: null,
        performanceDate: null,
        createTime: null,
        creatorId: null,
        creatorName: null,
        groupMemberId: null,
        groupMemberName: null,
        groupMemberTime: null,
        managerId: null,
        managerName: null,
        managerDatetime: null,
        performanceScore: null,
        deptId: null,
        deptName: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },/** 搜索按钮操作 */
    getAuditList(){
      if (this.activeName == 'yes'){
        this.getYesSubmitList();
      }else if (this.activeName == 'no'){
        this.getNoSubmitList();
      }
    },
    handleAuditQuery() {
      this.queryAuditParams.pageNum = 1;
      this.getAuditList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 重置按钮操作 */
    resetAuditQuery() {
      this.resetForm("queryAuditForm");
      if (this.activeName == 'yes'){
        this.handleYesAuditQuery();
      }else if (this.activeName == 'no'){
        this.handleNoAuditQuery();
      }

    },
    // 多选框选中数据
    handleSelectionChange(selection) {

      this.selectedRows = selection
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length

      /*if (selection.length > 0){
        this.selectedRow = selection[selection.length -1]
      }*/

      if (selection.length > 1) {
        this.$refs.multipleTableFrag.clearSelection()
        this.$refs.multipleTableFrag.toggleRowSelection(this.selectedRows.pop())
      }
      this.selectedRow = this.selectedRows[0]
      console.log(this.selectedRow)
    },

    /** 月度绩效提交情况查询 */
    handleAuditSubmitDetail() {
      this.reset();
      this.open = true;
      this.title = "月度绩效提交情况查询";
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/monthly/export', {
        ...this.queryParams
      }, `monthly_${new Date().getTime()}.xlsx`)
    },
    /** 直线经理评分按钮操作 */
    handleManagerAudit(row) {
      console.log("handleManagerAudit")
      let rowId = row.id || this.ids;
      this.$tab.openPage("直线经理评分", '/system/kpi-managerAudit/index',{id: rowId});
    },
    /** 绩效小组评分按钮操作 */
    handleGroupAudit(row) {
      console.log("handleGroupAudit")
      let rowId = row.id || this.ids;
      console.log(row.stateId)

      this.$tab.openPage("绩效小组评分", '/system/kpi-groupAudit/index',{id: rowId});
    },
    /** 录入月度绩效按钮操作 */
    handleAddKPI() {
      console.log("handleAddKpi")
      this.$tab.openPage("录入月度绩效", '/system/kpi-add/index',{op:'add'});
    },
    /** 查询月度绩效提交情况 */
    getYesSubmitList() {
      this.loading = true;
      listMonthlyAuditSubmitDetail(this.queryAuditParams).then(response => {
        console.log(response.total)
        this.yesTabData = response.rows;
        this.auditTotal = response.total;
        this.loading = false;
      });
    },
    getNoSubmitList() {
      this.loading = true;
      listMonthlyAuditNoSubmitDetail(this.queryAuditParams).then(response => {
        this.noTabData = response.rows;
        this.auditTotal = response.total;
        this.loading = false;
      });
    },
    handleQueryTabClick(tab, event){
      console.log("listAuditType-----------------"+this.listAuditType)
      /*if (this.listAuditType == 'alreadySubmit'){
        this.queryParams.stateId ='1'
      }else if (this.listAuditType == 'groupAudit'){
        this.queryParams.stateId ='2'
      }else if (this.listAuditType == 'managerAudit'){
        this.queryParams.stateId ='3'
      }*/
      this.getList()
    },
    handleTabClick(tab, event){
      console.log("activeName-----------------"+this.activeName)
      if (this.activeName == 'yes'){
        this.getYesSubmitList()
      }else if (this.activeName == 'no'){
        this.getNoSubmitList()
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.el-dialog-div{
  height: 60vh;
  overflow: auto;
}
</style>
